import { defineComponent, resolveComponent, openBlock, createBlock, mergeProps, resolveDynamicComponent, reactive, ref, computed, unref, withCtx, createVNode, createElementBlock, Fragment, renderList, withDirectives, vShow, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, onMounted, watch, onBeforeUnmount, normalizeStyle, renderSlot, normalizeProps, guardReactiveProps, pushScopeId, popScopeId, inject, createSlots, provide, normalizeClass, withModifiers } from "vue";
import { message } from "ant-design-vue";
import { debounce, upperFirst } from "lodash-es";
import * as $Icon from "@ant-design/icons-vue";
import { DownOutlined } from "@ant-design/icons-vue";
var cascader_vue_vue_type_style_index_0_scoped_true_lang = "";
var _export_sfc = (sfc, props) => {
  const target = sfc.__vccOpts || sfc;
  for (const [key, val] of props) {
    target[key] = val;
  }
  return target;
};
const _sfc_main$a = /* @__PURE__ */ defineComponent({
  __name: "cascader",
  props: {
    defaultValue: null,
    innerProps: null,
    options: null,
    value: null
  },
  emits: ["valuechange"],
  setup(__props, { emit }) {
    const props = __props;
    const onChange = (value) => {
      emit("valuechange", value);
    };
    return (_ctx, _cache) => {
      var _a;
      const _component_a_cascader = resolveComponent("a-cascader");
      return openBlock(), createBlock(_component_a_cascader, mergeProps({
        value: props.value,
        options: props.options,
        placeholder: ((_a = props.innerProps) == null ? void 0 : _a.placeholder) || "\u8BF7\u9009\u62E9"
      }, props.innerProps, { onChange }), null, 16, ["value", "options", "placeholder"]);
    };
  }
});
var comcascader = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-3141f3bf"]]);
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  __name: "select",
  props: {
    innerProps: null,
    options: null,
    value: null
  },
  emits: ["valuechange"],
  setup(__props, { emit }) {
    const props = __props;
    const onChange = (value) => {
      emit("valuechange", value);
    };
    return (_ctx, _cache) => {
      var _a;
      const _component_a_select = resolveComponent("a-select");
      return openBlock(), createBlock(_component_a_select, mergeProps({
        value: props.value,
        options: props.options,
        placeholder: ((_a = props.innerProps) == null ? void 0 : _a.placeholder) || "\u8BF7\u9009\u62E9"
      }, props.innerProps, { onChange }), null, 16, ["value", "options", "placeholder"]);
    };
  }
});
var datepicker_vue_vue_type_style_index_0_scoped_true_lang = "";
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  __name: "datepicker",
  props: {
    innerProps: null,
    value: null
  },
  emits: ["valuechange"],
  setup(__props, { emit }) {
    const props = __props;
    const onChange = (date) => {
      emit("valuechange", date);
    };
    return (_ctx, _cache) => {
      var _a;
      const _component_a_date_picker = resolveComponent("a-date-picker");
      return openBlock(), createBlock(_component_a_date_picker, mergeProps({
        value: props.value,
        placeholder: ((_a = __props.innerProps) == null ? void 0 : _a.placeholder) || "\u8BF7\u9009\u62E9"
      }, props == null ? void 0 : props.innerProps, { onChange }), null, 16, ["value", "placeholder"]);
    };
  }
});
var comdatepicker = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-264970c6"]]);
var rangepicker_vue_vue_type_style_index_0_scoped_true_lang = "";
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
  __name: "rangepicker",
  props: {
    innerProps: null,
    value: null
  },
  emits: ["valuechange"],
  setup(__props, { emit }) {
    const props = __props;
    const onChange = (dates) => {
      emit("valuechange", dates);
    };
    return (_ctx, _cache) => {
      var _a;
      const _component_a_range_picker = resolveComponent("a-range-picker");
      return openBlock(), createBlock(_component_a_range_picker, mergeProps({
        value: props.value
      }, props.innerProps, {
        placeholder: ((_a = __props.innerProps) == null ? void 0 : _a.placeholder) || ["\u5F00\u59CB\u65E5\u671F", "\u7ED3\u675F\u65E5\u671F"],
        onChange
      }), null, 16, ["value", "placeholder"]);
    };
  }
});
var comrangepicker = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-b8072960"]]);
const __default__$1 = {
  components: {
    comcascader,
    comselect: _sfc_main$9,
    comdatepicker,
    comrangepicker
  }
};
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  ...__default__$1,
  __name: "componentMap",
  props: {
    column: null,
    value: null
  },
  emits: ["change"],
  setup(__props, { emit }) {
    const props = __props;
    const valueChange = (val) => {
      emit("change", props.column.dataIndex, val);
    };
    return (_ctx, _cache) => {
      var _a, _b;
      return openBlock(), createBlock(resolveDynamicComponent("com" + ((_a = props.column.formItemProps) == null ? void 0 : _a.type)), mergeProps({
        ...props.column.formItemProps,
        value: props.value,
        innerProps: (_b = props.column.formItemProps) == null ? void 0 : _b.innerProps
      }, { onValuechange: valueChange }), null, 16);
    };
  }
});
var index_vue_vue_type_style_index_0_scoped_true_lang$2 = "";
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    span: { default: 8 },
    columns: null,
    defaultValue: null,
    defaultCollapsed: { type: Boolean, default: true },
    isCollapsed: { type: Boolean, default: false },
    linesCntToStartCollapse: { default: 3 },
    searchText: { default: "\u67E5\u8BE2" },
    resetText: { default: "\u91CD\u7F6E" },
    hideResetBtn: { type: Boolean, default: false }
  },
  emits: ["onSubmit", "onReset"],
  setup(__props, { expose, emit }) {
    const props = __props;
    let formState = reactive({ data: {} });
    let columnsState = reactive([]);
    const isOrder = props.columns.some((item) => Number.isInteger(item.order));
    const collapsed = ref(props.isCollapsed ? props.defaultCollapsed : false);
    let canCollapsed = ref(true);
    const formRef = ref();
    const collapseChange = () => {
      collapsed.value = !collapsed.value;
    };
    const calcuFormItemShow = (order) => {
      return props.isCollapsed && collapsed.value ? order * props.span < 24 * props.linesCntToStartCollapse - 4 : true;
    };
    const sortColumn = (a2, b2) => {
      if (a2.order && b2.order) {
        return +a2.order > +b2.order ? 1 : +a2.order < +b2.order ? -1 : 0;
      } else if (a2.order || b2.order) {
        return Number.isInteger(a2.order) ? -1 : 1;
      } else {
        return 0;
      }
    };
    (() => {
      columnsState = isOrder ? props.columns.sort(sortColumn) : props.columns;
      props.columns.forEach((item) => {
        formState.data[item.dataIndex] = props.defaultValue && props.defaultValue[item.dataIndex] ? props.defaultValue[item.dataIndex] : void 0;
      });
    })();
    const changeFormState = (key, value) => {
      formState.data[key] = value;
    };
    const actionOffset = computed(() => {
      let allFormSpan = props.span * props.columns.length;
      canCollapsed.value = allFormSpan > 24 * props.linesCntToStartCollapse - 4;
      if (collapsed.value && canCollapsed.value) {
        const lastIndex = columnsState.findIndex((item, index2) => (index2 + 1) * props.span > 24 * props.linesCntToStartCollapse - 4);
        allFormSpan = props.span * lastIndex;
      }
      return 24 - allFormSpan % 24 - 4;
    });
    const onFinish = (values) => {
      emit("onSubmit", values);
    };
    const onReset = () => {
      var _a, _b;
      (_a = formRef.value) == null ? void 0 : _a.resetFields();
      const val = (_b = formRef.value) == null ? void 0 : _b.getFieldsValue();
      emit("onReset", val);
    };
    const setFormValues = (values) => {
      formState.data = reactive({ ...formState.data, ...values });
    };
    const getFormValues = () => {
      var _a;
      return (_a = formRef.value) == null ? void 0 : _a.getFieldsValue();
    };
    const resetFormValues = () => {
      var _a;
      return (_a = formRef.value) == null ? void 0 : _a.resetFields();
    };
    expose({
      getFormValues,
      resetFormValues,
      setFormValues
    });
    return (_ctx, _cache) => {
      const _component_a_input = resolveComponent("a-input");
      const _component_a_form_item = resolveComponent("a-form-item");
      const _component_a_col = resolveComponent("a-col");
      const _component_a_button = resolveComponent("a-button");
      const _component_up_outlined = resolveComponent("up-outlined");
      const _component_down_outlined = resolveComponent("down-outlined");
      const _component_a_space = resolveComponent("a-space");
      const _component_a_row = resolveComponent("a-row");
      const _component_a_form = resolveComponent("a-form");
      return openBlock(), createBlock(_component_a_form, {
        model: unref(formState).data,
        ref_key: "formRef",
        ref: formRef,
        autocomplete: "off",
        onFinish
      }, {
        default: withCtx(() => [
          createVNode(_component_a_row, {
            gutter: 20,
            align: "top"
          }, {
            default: withCtx(() => [
              (openBlock(true), createElementBlock(Fragment, null, renderList(unref(columnsState), (column, index2) => {
                return withDirectives((openBlock(), createBlock(_component_a_col, {
                  span: props.span,
                  key: index2
                }, {
                  default: withCtx(() => [
                    createVNode(_component_a_form_item, {
                      label: column.title,
                      name: column.dataIndex
                    }, {
                      default: withCtx(() => {
                        var _a, _b, _c, _d;
                        return [
                          ((_a = column.formItemProps) == null ? void 0 : _a.type) && ((_b = column.formItemProps) == null ? void 0 : _b.type) !== "input" ? (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 0 }, {
                            column,
                            value: unref(formState).data[column.dataIndex]
                          }, { onChange: changeFormState }), null, 16)) : (openBlock(), createBlock(_component_a_input, {
                            key: 1,
                            value: unref(formState).data[column.dataIndex],
                            "onUpdate:value": ($event) => unref(formState).data[column.dataIndex] = $event,
                            placeholder: ((_d = (_c = column.formItemProps) == null ? void 0 : _c.innerProps) == null ? void 0 : _d.placeholder) || "\u8BF7\u8F93\u5165"
                          }, null, 8, ["value", "onUpdate:value", "placeholder"]))
                        ];
                      }),
                      _: 2
                    }, 1032, ["label", "name"])
                  ]),
                  _: 2
                }, 1032, ["span"])), [
                  [vShow, calcuFormItemShow(index2 + 1)]
                ]);
              }), 128)),
              createVNode(_component_a_col, {
                span: "4",
                offset: unref(actionOffset),
                class: "action-col"
              }, {
                default: withCtx(() => [
                  createVNode(_component_a_space, null, {
                    default: withCtx(() => [
                      createVNode(_component_a_button, {
                        type: "primary",
                        "html-type": "submit"
                      }, {
                        default: withCtx(() => [
                          createTextVNode(toDisplayString(props.searchText || "\u67E5\u8BE2"), 1)
                        ]),
                        _: 1
                      }),
                      !props.hideResetBtn ? (openBlock(), createBlock(_component_a_button, {
                        key: 0,
                        type: "primary",
                        onClick: onReset
                      }, {
                        default: withCtx(() => [
                          createTextVNode(toDisplayString(props.resetText || "\u91CD\u7F6E"), 1)
                        ]),
                        _: 1
                      })) : createCommentVNode("", true),
                      __props.isCollapsed && unref(canCollapsed) ? (openBlock(), createBlock(_component_a_button, {
                        key: 1,
                        type: "link",
                        onClick: collapseChange
                      }, {
                        default: withCtx(() => [
                          createTextVNode(toDisplayString(collapsed.value ? "\u5C55\u5F00" : "\u6536\u8D77") + " ", 1),
                          withDirectives(createVNode(_component_up_outlined, null, null, 512), [
                            [vShow, !collapsed.value]
                          ]),
                          withDirectives(createVNode(_component_down_outlined, null, null, 512), [
                            [vShow, collapsed.value]
                          ])
                        ]),
                        _: 1
                      })) : createCommentVNode("", true)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["offset"])
            ]),
            _: 1
          })
        ]),
        _: 1
      }, 8, ["model"]);
    };
  }
});
var SearchFormComponent = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-81b9b5d2"]]);
/*!
 * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
 *
 * Copyright (c) 2014-2017, Jon Schlinkert.
 * Released under the MIT License.
 */
function isObject(o2) {
  return Object.prototype.toString.call(o2) === "[object Object]";
}
function isPlainObject(o2) {
  var ctor, prot;
  if (isObject(o2) === false)
    return false;
  ctor = o2.constructor;
  if (ctor === void 0)
    return true;
  prot = ctor.prototype;
  if (isObject(prot) === false)
    return false;
  if (prot.hasOwnProperty("isPrototypeOf") === false) {
    return false;
  }
  return true;
}
function t() {
  return t = Object.assign ? Object.assign.bind() : function(e) {
    for (var t2 = 1; t2 < arguments.length; t2++) {
      var r2 = arguments[t2];
      for (var n2 in r2)
        Object.prototype.hasOwnProperty.call(r2, n2) && (e[n2] = r2[n2]);
    }
    return e;
  }, t.apply(this, arguments);
}
function r(e, t2) {
  if (null == e)
    return {};
  var r2, n2, i2 = {}, o2 = Object.keys(e);
  for (n2 = 0; n2 < o2.length; n2++)
    t2.indexOf(r2 = o2[n2]) >= 0 || (i2[r2] = e[r2]);
  return i2;
}
const n = { silent: false, logLevel: "warn" }, i = ["validator"], o = Object.prototype, a = o.toString, s = o.hasOwnProperty, u = /^\s*function (\w+)/;
function l(e) {
  var t2;
  const r2 = null !== (t2 = null == e ? void 0 : e.type) && void 0 !== t2 ? t2 : e;
  if (r2) {
    const e2 = r2.toString().match(u);
    return e2 ? e2[1] : "";
  }
  return "";
}
const c = isPlainObject, f = (e) => e;
let d = f;
const p = (e, t2) => s.call(e, t2), y = Number.isInteger || function(e) {
  return "number" == typeof e && isFinite(e) && Math.floor(e) === e;
}, v = Array.isArray || function(e) {
  return "[object Array]" === a.call(e);
}, h = (e) => "[object Function]" === a.call(e), b = (e) => c(e) && p(e, "_vueTypes_name"), g = (e) => c(e) && (p(e, "type") || ["_vueTypes_name", "validator", "default", "required"].some((t2) => p(e, t2)));
function O(e, t2) {
  return Object.defineProperty(e.bind(t2), "__original", { value: e });
}
function m(e, t2, r2 = false) {
  let n2, i2 = true, o2 = "";
  n2 = c(e) ? e : { type: e };
  const a2 = b(n2) ? n2._vueTypes_name + " - " : "";
  if (g(n2) && null !== n2.type) {
    if (void 0 === n2.type || true === n2.type)
      return i2;
    if (!n2.required && void 0 === t2)
      return i2;
    v(n2.type) ? (i2 = n2.type.some((e2) => true === m(e2, t2, true)), o2 = n2.type.map((e2) => l(e2)).join(" or ")) : (o2 = l(n2), i2 = "Array" === o2 ? v(t2) : "Object" === o2 ? c(t2) : "String" === o2 || "Number" === o2 || "Boolean" === o2 || "Function" === o2 ? function(e2) {
      if (null == e2)
        return "";
      const t3 = e2.constructor.toString().match(u);
      return t3 ? t3[1] : "";
    }(t2) === o2 : t2 instanceof n2.type);
  }
  if (!i2) {
    const e2 = `${a2}value "${t2}" should be of type "${o2}"`;
    return false === r2 ? (d(e2), false) : e2;
  }
  if (p(n2, "validator") && h(n2.validator)) {
    const e2 = d, o3 = [];
    if (d = (e3) => {
      o3.push(e3);
    }, i2 = n2.validator(t2), d = e2, !i2) {
      const e3 = (o3.length > 1 ? "* " : "") + o3.join("\n* ");
      return o3.length = 0, false === r2 ? (d(e3), i2) : e3;
    }
  }
  return i2;
}
function j(e, t2) {
  const r2 = Object.defineProperties(t2, { _vueTypes_name: { value: e, writable: true }, isRequired: { get() {
    return this.required = true, this;
  } }, def: { value(e2) {
    return void 0 === e2 ? (p(this, "default") && delete this.default, this) : h(e2) || true === m(this, e2, true) ? (this.default = v(e2) ? () => [...e2] : c(e2) ? () => Object.assign({}, e2) : e2, this) : (d(`${this._vueTypes_name} - invalid default value: "${e2}"`), this);
  } } }), { validator: n2 } = r2;
  return h(n2) && (r2.validator = O(n2, r2)), r2;
}
function _(e, t2) {
  const r2 = j(e, t2);
  return Object.defineProperty(r2, "validate", { value(e2) {
    return h(this.validator) && d(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info:
${JSON.stringify(this)}`), this.validator = O(e2, this), this;
  } });
}
function T(e, t2, n2) {
  const o2 = function(e2) {
    const t3 = {};
    return Object.getOwnPropertyNames(e2).forEach((r2) => {
      t3[r2] = Object.getOwnPropertyDescriptor(e2, r2);
    }), Object.defineProperties({}, t3);
  }(t2);
  if (o2._vueTypes_name = e, !c(n2))
    return o2;
  const { validator: a2 } = n2, s2 = r(n2, i);
  if (h(a2)) {
    let { validator: e2 } = o2;
    e2 && (e2 = null !== (l2 = (u2 = e2).__original) && void 0 !== l2 ? l2 : u2), o2.validator = O(e2 ? function(t3) {
      return e2.call(this, t3) && a2.call(this, t3);
    } : a2, o2);
  }
  var u2, l2;
  return Object.assign(o2, s2);
}
function $(e) {
  return e.replace(/^(?!\s*$)/gm, "  ");
}
const w = () => _("any", {}), P = () => _("function", { type: Function }), x = () => _("boolean", { type: Boolean }), E = () => _("string", { type: String }), N = () => _("number", { type: Number }), q = () => _("array", { type: Array }), A = () => _("object", { type: Object }), V = () => j("integer", { type: Number, validator: (e) => y(e) }), S = () => j("symbol", { validator: (e) => "symbol" == typeof e });
function D(e, t2 = "custom validation failed") {
  if ("function" != typeof e)
    throw new TypeError("[VueTypes error]: You must provide a function as argument");
  return j(e.name || "<<anonymous function>>", { type: null, validator(r2) {
    const n2 = e(r2);
    return n2 || d(`${this._vueTypes_name} - ${t2}`), n2;
  } });
}
function L(e) {
  if (!v(e))
    throw new TypeError("[VueTypes error]: You must provide an array as argument.");
  const t2 = `oneOf - value should be one of "${e.join('", "')}".`, r2 = e.reduce((e2, t3) => {
    if (null != t3) {
      const r3 = t3.constructor;
      -1 === e2.indexOf(r3) && e2.push(r3);
    }
    return e2;
  }, []);
  return j("oneOf", { type: r2.length > 0 ? r2 : void 0, validator(r3) {
    const n2 = -1 !== e.indexOf(r3);
    return n2 || d(t2), n2;
  } });
}
function F(e) {
  if (!v(e))
    throw new TypeError("[VueTypes error]: You must provide an array as argument");
  let t2 = false, r2 = [];
  for (let n3 = 0; n3 < e.length; n3 += 1) {
    const i2 = e[n3];
    if (g(i2)) {
      if (b(i2) && "oneOf" === i2._vueTypes_name && i2.type) {
        r2 = r2.concat(i2.type);
        continue;
      }
      if (h(i2.validator) && (t2 = true), true === i2.type || !i2.type) {
        d('oneOfType - invalid usage of "true" or "null" as types.');
        continue;
      }
      r2 = r2.concat(i2.type);
    } else
      r2.push(i2);
  }
  r2 = r2.filter((e2, t3) => r2.indexOf(e2) === t3);
  const n2 = r2.length > 0 ? r2 : null;
  return j("oneOfType", t2 ? { type: n2, validator(t3) {
    const r3 = [], n3 = e.some((e2) => {
      const n4 = m(b(e2) && "oneOf" === e2._vueTypes_name ? e2.type || null : e2, t3, true);
      return "string" == typeof n4 && r3.push(n4), true === n4;
    });
    return n3 || d(`oneOfType - provided value does not match any of the ${r3.length} passed-in validators:
${$(r3.join("\n"))}`), n3;
  } } : { type: n2 });
}
function Y(e) {
  return j("arrayOf", { type: Array, validator(t2) {
    let r2 = "";
    const n2 = t2.every((t3) => (r2 = m(e, t3, true), true === r2));
    return n2 || d(`arrayOf - value validation error:
${$(r2)}`), n2;
  } });
}
function B(e) {
  return j("instanceOf", { type: e });
}
function I(e) {
  return j("objectOf", { type: Object, validator(t2) {
    let r2 = "";
    const n2 = Object.keys(t2).every((n3) => (r2 = m(e, t2[n3], true), true === r2));
    return n2 || d(`objectOf - value validation error:
${$(r2)}`), n2;
  } });
}
function J(e) {
  const t2 = Object.keys(e), r2 = t2.filter((t3) => {
    var r3;
    return !(null === (r3 = e[t3]) || void 0 === r3 || !r3.required);
  }), n2 = j("shape", { type: Object, validator(n3) {
    if (!c(n3))
      return false;
    const i2 = Object.keys(n3);
    if (r2.length > 0 && r2.some((e2) => -1 === i2.indexOf(e2))) {
      const e2 = r2.filter((e3) => -1 === i2.indexOf(e3));
      return d(1 === e2.length ? `shape - required property "${e2[0]}" is not defined.` : `shape - required properties "${e2.join('", "')}" are not defined.`), false;
    }
    return i2.every((r3) => {
      if (-1 === t2.indexOf(r3))
        return true === this._vueTypes_isLoose || (d(`shape - shape definition does not include a "${r3}" property. Allowed keys: "${t2.join('", "')}".`), false);
      const i3 = m(e[r3], n3[r3], true);
      return "string" == typeof i3 && d(`shape - "${r3}" property validation error:
 ${$(i3)}`), true === i3;
    });
  } });
  return Object.defineProperty(n2, "_vueTypes_isLoose", { writable: true, value: false }), Object.defineProperty(n2, "loose", { get() {
    return this._vueTypes_isLoose = true, this;
  } }), n2;
}
const M = ["name", "validate", "getter"], R = /* @__PURE__ */ (() => {
  var e;
  return (e = class {
    static get any() {
      return w();
    }
    static get func() {
      return P().def(this.defaults.func);
    }
    static get bool() {
      return x().def(this.defaults.bool);
    }
    static get string() {
      return E().def(this.defaults.string);
    }
    static get number() {
      return N().def(this.defaults.number);
    }
    static get array() {
      return q().def(this.defaults.array);
    }
    static get object() {
      return A().def(this.defaults.object);
    }
    static get integer() {
      return V().def(this.defaults.integer);
    }
    static get symbol() {
      return S();
    }
    static get nullable() {
      return { type: null };
    }
    static extend(e2) {
      if (v(e2))
        return e2.forEach((e3) => this.extend(e3)), this;
      const { name: t2, validate: n2 = false, getter: i2 = false } = e2, o2 = r(e2, M);
      if (p(this, t2))
        throw new TypeError(`[VueTypes error]: Type "${t2}" already defined`);
      const { type: a2 } = o2;
      if (b(a2))
        return delete o2.type, Object.defineProperty(this, t2, i2 ? { get: () => T(t2, a2, o2) } : { value(...e3) {
          const r2 = T(t2, a2, o2);
          return r2.validator && (r2.validator = r2.validator.bind(r2, ...e3)), r2;
        } });
      let s2;
      return s2 = i2 ? { get() {
        const e3 = Object.assign({}, o2);
        return n2 ? _(t2, e3) : j(t2, e3);
      }, enumerable: true } : { value(...e3) {
        const r2 = Object.assign({}, o2);
        let i3;
        return i3 = n2 ? _(t2, r2) : j(t2, r2), r2.validator && (i3.validator = r2.validator.bind(i3, ...e3)), i3;
      }, enumerable: true }, Object.defineProperty(this, t2, s2);
    }
  }).defaults = {}, e.sensibleDefaults = void 0, e.config = n, e.custom = D, e.oneOf = L, e.instanceOf = B, e.oneOfType = F, e.arrayOf = Y, e.objectOf = I, e.shape = J, e.utils = { validate: (e2, t2) => true === m(t2, e2, true), toType: (e2, t2, r2 = false) => r2 ? _(e2, t2) : j(e2, t2) }, e;
})();
function z(e = { func: () => {
}, bool: true, string: "", number: 0, array: () => [], object: () => ({}), integer: 0 }) {
  var r2;
  return (r2 = class extends R {
    static get sensibleDefaults() {
      return t({}, this.defaults);
    }
    static set sensibleDefaults(r3) {
      this.defaults = false !== r3 ? t({}, true !== r3 ? r3 : e) : {};
    }
  }).defaults = t({}, e), r2;
}
class C extends z() {
}
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
var dist = { exports: {} };
(function(module, exports) {
  (function(m2, p2) {
    module.exports = p2();
  })(commonjsGlobal, function() {
    function m2(a2) {
      var b3 = [];
      a2.AMapUI && b3.push(p2(a2.AMapUI));
      a2.Loca && b3.push(r2(a2.Loca));
      return Promise.all(b3);
    }
    function p2(a2) {
      return new Promise(function(h2, c2) {
        var f2 = [];
        if (a2.plugins)
          for (var e = 0; e < a2.plugins.length; e += 1)
            -1 == d2.AMapUI.plugins.indexOf(a2.plugins[e]) && f2.push(a2.plugins[e]);
        if (g2.AMapUI === b2.failed)
          c2("\u524D\u6B21\u8BF7\u6C42 AMapUI \u5931\u8D25");
        else if (g2.AMapUI === b2.notload) {
          g2.AMapUI = b2.loading;
          d2.AMapUI.version = a2.version || d2.AMapUI.version;
          e = d2.AMapUI.version;
          var l2 = document.body || document.head, k = document.createElement("script");
          k.type = "text/javascript";
          k.src = "https://webapi.amap.com/ui/" + e + "/main.js";
          k.onerror = function(a3) {
            g2.AMapUI = b2.failed;
            c2("\u8BF7\u6C42 AMapUI \u5931\u8D25");
          };
          k.onload = function() {
            g2.AMapUI = b2.loaded;
            if (f2.length)
              window.AMapUI.loadUI(f2, function() {
                for (var a3 = 0, b3 = f2.length; a3 < b3; a3++) {
                  var c3 = f2[a3].split("/").slice(-1)[0];
                  window.AMapUI[c3] = arguments[a3];
                }
                for (h2(); n2.AMapUI.length; )
                  n2.AMapUI.splice(0, 1)[0]();
              });
            else
              for (h2(); n2.AMapUI.length; )
                n2.AMapUI.splice(0, 1)[0]();
          };
          l2.appendChild(k);
        } else
          g2.AMapUI === b2.loaded ? a2.version && a2.version !== d2.AMapUI.version ? c2("\u4E0D\u5141\u8BB8\u591A\u4E2A\u7248\u672C AMapUI \u6DF7\u7528") : f2.length ? window.AMapUI.loadUI(f2, function() {
            for (var a3 = 0, b3 = f2.length; a3 < b3; a3++) {
              var c3 = f2[a3].split("/").slice(-1)[0];
              window.AMapUI[c3] = arguments[a3];
            }
            h2();
          }) : h2() : a2.version && a2.version !== d2.AMapUI.version ? c2("\u4E0D\u5141\u8BB8\u591A\u4E2A\u7248\u672C AMapUI \u6DF7\u7528") : n2.AMapUI.push(function(a3) {
            a3 ? c2(a3) : f2.length ? window.AMapUI.loadUI(f2, function() {
              for (var a4 = 0, b3 = f2.length; a4 < b3; a4++) {
                var c3 = f2[a4].split("/").slice(-1)[0];
                window.AMapUI[c3] = arguments[a4];
              }
              h2();
            }) : h2();
          });
      });
    }
    function r2(a2) {
      return new Promise(function(h2, c2) {
        if (g2.Loca === b2.failed)
          c2("\u524D\u6B21\u8BF7\u6C42 Loca \u5931\u8D25");
        else if (g2.Loca === b2.notload) {
          g2.Loca = b2.loading;
          d2.Loca.version = a2.version || d2.Loca.version;
          var f2 = d2.Loca.version, e = d2.AMap.version.startsWith("2"), l2 = f2.startsWith("2");
          if (e && !l2 || !e && l2)
            c2("JSAPI \u4E0E Loca \u7248\u672C\u4E0D\u5BF9\u5E94\uFF01\uFF01");
          else {
            e = d2.key;
            l2 = document.body || document.head;
            var k = document.createElement("script");
            k.type = "text/javascript";
            k.src = "https://webapi.amap.com/loca?v=" + f2 + "&key=" + e;
            k.onerror = function(a3) {
              g2.Loca = b2.failed;
              c2("\u8BF7\u6C42 AMapUI \u5931\u8D25");
            };
            k.onload = function() {
              g2.Loca = b2.loaded;
              for (h2(); n2.Loca.length; )
                n2.Loca.splice(0, 1)[0]();
            };
            l2.appendChild(k);
          }
        } else
          g2.Loca === b2.loaded ? a2.version && a2.version !== d2.Loca.version ? c2("\u4E0D\u5141\u8BB8\u591A\u4E2A\u7248\u672C Loca \u6DF7\u7528") : h2() : a2.version && a2.version !== d2.Loca.version ? c2("\u4E0D\u5141\u8BB8\u591A\u4E2A\u7248\u672C Loca \u6DF7\u7528") : n2.Loca.push(function(a3) {
            a3 ? c2(a3) : c2();
          });
      });
    }
    if (!window)
      throw Error("AMap JSAPI can only be used in Browser.");
    var b2;
    (function(a2) {
      a2.notload = "notload";
      a2.loading = "loading";
      a2.loaded = "loaded";
      a2.failed = "failed";
    })(b2 || (b2 = {}));
    var d2 = { key: "", AMap: { version: "1.4.15", plugins: [] }, AMapUI: { version: "1.1", plugins: [] }, Loca: { version: "1.3.2" } }, g2 = { AMap: b2.notload, AMapUI: b2.notload, Loca: b2.notload }, n2 = { AMap: [], AMapUI: [], Loca: [] }, q2 = [], t2 = function(a2) {
      "function" == typeof a2 && (g2.AMap === b2.loaded ? a2(window.AMap) : q2.push(a2));
    };
    return { load: function(a2) {
      return new Promise(function(h2, c2) {
        if (g2.AMap == b2.failed)
          c2("");
        else if (g2.AMap == b2.notload) {
          var f2 = a2.key, e = a2.version, l2 = a2.plugins;
          f2 ? (window.AMap && "lbs.amap.com" !== location.host && c2("\u7981\u6B62\u591A\u79CDAPI\u52A0\u8F7D\u65B9\u5F0F\u6DF7\u7528"), d2.key = f2, d2.AMap.version = e || d2.AMap.version, d2.AMap.plugins = l2 || d2.AMap.plugins, g2.AMap = b2.loading, e = document.body || document.head, window.___onAPILoaded = function(d3) {
            delete window.___onAPILoaded;
            if (d3)
              g2.AMap = b2.failed, c2(d3);
            else
              for (g2.AMap = b2.loaded, m2(a2).then(function() {
                h2(window.AMap);
              })["catch"](c2); q2.length; )
                q2.splice(0, 1)[0]();
          }, l2 = document.createElement("script"), l2.type = "text/javascript", l2.src = "https://webapi.amap.com/maps?callback=___onAPILoaded&v=" + d2.AMap.version + "&key=" + f2 + "&plugin=" + d2.AMap.plugins.join(","), l2.onerror = function(a3) {
            g2.AMap = b2.failed;
            c2(a3);
          }, e.appendChild(l2)) : c2("\u8BF7\u586B\u5199key");
        } else if (g2.AMap == b2.loaded)
          if (a2.key && a2.key !== d2.key)
            c2("\u591A\u4E2A\u4E0D\u4E00\u81F4\u7684 key");
          else if (a2.version && a2.version !== d2.AMap.version)
            c2("\u4E0D\u5141\u8BB8\u591A\u4E2A\u7248\u672C JSAPI \u6DF7\u7528");
          else {
            f2 = [];
            if (a2.plugins)
              for (e = 0; e < a2.plugins.length; e += 1)
                -1 == d2.AMap.plugins.indexOf(a2.plugins[e]) && f2.push(a2.plugins[e]);
            if (f2.length)
              window.AMap.plugin(f2, function() {
                m2(a2).then(function() {
                  h2(window.AMap);
                })["catch"](c2);
              });
            else
              m2(a2).then(function() {
                h2(window.AMap);
              })["catch"](c2);
          }
        else if (a2.key && a2.key !== d2.key)
          c2("\u591A\u4E2A\u4E0D\u4E00\u81F4\u7684 key");
        else if (a2.version && a2.version !== d2.AMap.version)
          c2("\u4E0D\u5141\u8BB8\u591A\u4E2A\u7248\u672C JSAPI \u6DF7\u7528");
        else {
          var k = [];
          if (a2.plugins)
            for (e = 0; e < a2.plugins.length; e += 1)
              -1 == d2.AMap.plugins.indexOf(a2.plugins[e]) && k.push(a2.plugins[e]);
          t2(function() {
            if (k.length)
              window.AMap.plugin(k, function() {
                m2(a2).then(function() {
                  h2(window.AMap);
                })["catch"](c2);
              });
            else
              m2(a2).then(function() {
                h2(window.AMap);
              })["catch"](c2);
          });
        }
      });
    }, reset: function() {
      delete window.AMap;
      delete window.AMapUI;
      delete window.Loca;
      d2 = { key: "", AMap: { version: "1.4.15", plugins: [] }, AMapUI: { version: "1.1", plugins: [] }, Loca: { version: "1.3.2" } };
      g2 = {
        AMap: b2.notload,
        AMapUI: b2.notload,
        Loca: b2.notload
      };
      n2 = { AMap: [], AMapUI: [], Loca: [] };
    } };
  });
})(dist);
var AMapLoader = dist.exports;
function isDef(value) {
  return typeof value !== "undefined";
}
const _hoisted_1$4 = {
  xmlns: "http://www.w3.org/2000/svg",
  width: "24",
  height: "24"
};
const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("path", {
  fill: "none",
  d: "M0 0h24v24H0z"
}, null, -1);
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("path", { d: "m18.031 16.617 4.283 4.282-1.415 1.415-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9 9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617zm-2.006-.742A6.977 6.977 0 0 0 18 11c0-3.868-3.133-7-7-7-3.868 0-7 3.132-7 7 0 3.867 3.132 7 7 7a6.977 6.977 0 0 0 4.875-1.975l.15-.15z" }, null, -1);
const _hoisted_4$4 = [
  _hoisted_2$4,
  _hoisted_3$4
];
function render$1(_ctx, _cache) {
  return openBlock(), createElementBlock("svg", _hoisted_1$4, _hoisted_4$4);
}
var SearchLine = { render: render$1 };
const aMapSearchResultStatus = {
  complete: "complete",
  noData: "no_data"
};
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1$3 = { class: "map-select" };
const _hoisted_2$3 = ["id"];
const _hoisted_3$3 = {
  key: 0,
  class: "search-wrap"
};
const _hoisted_4$3 = { class: "search-input-wrap" };
const _hoisted_5$2 = ["onClick"];
const _hoisted_6$2 = { class: "area-name" };
const _hoisted_7$2 = { class: "area-address" };
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    value: C.string.isRequired,
    address: C.string.def(""),
    aMapKey: C.string.def(""),
    aMapSecurity: C.string.def(""),
    aMapInstance: C.any.def(null),
    locationStorageKey: C.string.def(""),
    showSearch: C.bool.def(true),
    mapWidth: C.string.def("600px"),
    mapHeight: C.string.def("600px"),
    defaultCenter: C.arrayOf(C.number).def([116.397428, 39.90923]),
    mapOptions: C.object.def({})
  },
  emits: ["change", "update:value"],
  setup(__props, { expose, emit: emits }) {
    const props = __props;
    let map = null;
    let marker = null;
    const addressLocal = ref("");
    let autocomplete = null;
    let geocoder = null;
    let placeSearch = null;
    const isShowResult = ref(false);
    const addressInfo = ref({});
    let isMounted = false;
    let isClick = false;
    const mapRef = ref(null);
    const searchResultHeight = computed(() => {
      const mapClientHeight = mapRef.value ? mapRef.value.clientHeight : 0;
      return mapClientHeight >= 600 ? "500px" : mapClientHeight - 62 + "px";
    });
    const currentLocation = reactive({
      longitude: null,
      latitude: null
    });
    let globalAMap = null;
    let mapElementId = `J_map_${Math.random().toString(36).slice(2, 10)}`;
    onMounted(() => {
      init();
      isMounted = true;
      isClick = false;
    });
    function init() {
      if (!isSelectLocation()) {
        let previousLocation;
        if (typeof window !== "undefined") {
          previousLocation = props.locationStorageKey ? window.localStorage.getItem(props.locationStorageKey) || "" : "";
        }
        if (previousLocation) {
          const [longitude, latitude] = previousLocation.split(",").map((str) => parseFloat(str));
          currentLocation.latitude = latitude;
          currentLocation.longitude = longitude;
          initMap(longitude, latitude, false);
        } else {
          const [longitude, latitude] = props.defaultCenter;
          initMap(longitude, latitude, false);
        }
      } else {
        const { longitude, latitude } = currentLocation;
        initMap(longitude, latitude);
      }
    }
    function isSelectLocation() {
      return !!currentLocation.longitude && !!currentLocation.latitude;
    }
    function initMap(longitude, latitude, needInitMarker = true) {
      if (!props.aMapInstance) {
        if (typeof window !== "undefined") {
          window["_AMapSecurityConfig"] = {
            securityJsCode: props.aMapSecurity
          };
        }
        AMapLoader.load({
          key: props.aMapKey,
          version: "2.0",
          plugins: ["AMap.AutoComplete,AMap.PlaceSearch,AMap.Geocoder"]
        }).then((AMap) => {
          initMapContainer(AMap, longitude, latitude, needInitMarker);
        }).catch((e) => {
          console.error(e);
        });
      } else {
        initMapContainer(props.aMapInstance, longitude, latitude, needInitMarker);
      }
    }
    function initMapContainer(AMap, longitude, latitude, needInitMarker = true) {
      globalAMap = AMap;
      const options = {
        resizeEnable: true,
        center: new AMap.LngLat(longitude, latitude),
        zoom: 10,
        ...props.mapOptions
      };
      if (map) {
        map.setZoom(10);
        map.setCenter(new AMap.LngLat(longitude, latitude), true, 0);
      } else {
        map = new AMap.Map(mapElementId, options);
      }
      geocoder = geocoder || new AMap.Geocoder({});
      placeSearch = placeSearch || new AMap.PlaceSearch({
        map
      });
      AMap.Event.addListener(placeSearch, "markerClick", (e) => {
        const { lng, lat } = e.data.location;
        getAddress(lng, lat).then(() => {
          changeValue(lng, lat, addressLocal.value);
          map.clearMap();
        });
      });
      map.on("click", (e) => {
        isClick = true;
        const lng = e.lnglat.getLng();
        const lat = e.lnglat.getLat();
        currentLocation.longitude = lng;
        currentLocation.latitude = lat;
        getAddress(lng, lat).then(() => {
          changeValue(lng, lat, addressLocal.value);
        });
      });
      initMarker(longitude, latitude, needInitMarker);
      autocomplete = new AMap.AutoComplete();
    }
    function initMarker(longitude, latitude, needInitMarker = true) {
      if (!needInitMarker)
        return;
      if (!globalAMap)
        return;
      if (marker) {
        map.remove(marker);
      }
      isClick ? map.setCenter([longitude, latitude]) : map.setCenter([longitude, latitude], true, 0);
      isClick = false;
      marker = new globalAMap.Marker({
        icon: new globalAMap.Icon({
          image: "http://lishiots.oss-cn-hangzhou.aliyuncs.com/webstatic/poi-marker.png",
          size: new globalAMap.Size(34, 34),
          imageSize: new globalAMap.Size(34, 34)
        }),
        anchor: "bottom-center",
        position: [longitude, latitude]
      });
      map.add(marker);
    }
    const condition = ref("");
    const searchResult = ref([]);
    const handleKeywordInput = debounce(function(e) {
      if (!e.target.value) {
        searchResult.value = [];
        return;
      }
      autocomplete.search(e.target.value, (status, result) => {
        if (status === aMapSearchResultStatus.complete && result.info === "OK") {
          searchResult.value = result.tips.map((item) => {
            return {
              ...item,
              address: Array.isArray(item.address) ? item.address[0] || "" : item.address
            };
          });
          isShowResult.value = true;
        } else if (status === aMapSearchResultStatus.noData) {
          message.info("\u5F53\u524D\u5173\u952E\u8BCD\u672A\u641C\u7D22\u5230\u6570\u636E");
          searchResult.value = [];
        } else {
          message.error("\u83B7\u53D6\u641C\u7D22\u6570\u636E\u9519\u8BEF");
        }
      });
    }, 200);
    function handleClickResult(e) {
      const { location: location2, district, address } = e;
      const { lng, lat } = location2 || {};
      if (isDef(lng) && isDef(lat)) {
        if (isDef(district) && isDef(address)) {
          changeValue(lng, lat, district + address);
          map.clearMap();
        } else {
          if (currentLocation.longitude !== lng || currentLocation.latitude !== lat) {
            currentLocation.latitude = lat;
            currentLocation.longitude = lng;
            map.setCenter(new globalAMap.LngLat(lng, lat));
            getAddress(lng, lat).then(() => {
              changeValue(lng, lat, addressLocal.value);
              map.clearMap();
            });
          }
        }
      } else {
        placeSearch.setCity(e.adcode);
        placeSearch.search(e.name, (status, result) => {
          if (status === aMapSearchResultStatus.complete) {
            try {
              const { lng: lng2, lat: lat2 } = result.poiList.pois[0].location;
              getAddress(lng2, lat2).then(() => {
                changeValue(lng2, lat2, addressLocal.value);
                map.clearMap();
              });
            } catch (e2) {
              message.error("\u672A\u641C\u7D22\u5230\u5730\u70B9\uFF0C\u8BF7\u91CD\u8BD5");
            }
          }
        });
      }
      isShowResult.value = false;
    }
    function getAddress(lng, lat) {
      return new Promise((resolve) => {
        if (isDef(lat) && isDef(lng)) {
          geocoder.getAddress([lng, lat], function(status, result) {
            if (status === "complete" && result.info === "OK") {
              addressLocal.value = result.regeocode.formattedAddress;
            } else {
              addressLocal.value = "";
            }
            resolve(addressLocal.value);
          });
        } else {
          resolve(addressLocal.value);
        }
      });
    }
    function changeValue(longitude, latitude, address) {
      isShowResult.value = false;
      if (typeof window !== "undefined") {
        props.locationStorageKey && window.localStorage.setItem(props.locationStorageKey, `${longitude},${latitude}`);
      }
      addressInfo.value = {
        latitude,
        longitude,
        address
      };
      emits("update:value", `${longitude},${latitude}`);
      emits("change", addressInfo.value);
    }
    watch(() => props.value, () => {
      if (props.value) {
        const [longitude, latitude] = props.value.split(",").map((str) => parseFloat(str));
        currentLocation.latitude = latitude;
        currentLocation.longitude = longitude;
        isMounted && initMarker(longitude, latitude, true);
      } else {
        currentLocation.latitude = null;
        currentLocation.longitude = null;
      }
    }, { immediate: true });
    onBeforeUnmount(() => {
      destroyData();
      destroyMap();
    });
    function destroyMap() {
      try {
        if (map) {
          map.clearMap();
          map.destroy && map.destroy();
        }
        map = null;
        marker = null;
        geocoder = null;
        placeSearch = null;
        autocomplete = null;
      } catch (e) {
        console.error(e);
      }
    }
    function destroyData() {
      searchResult.value = [];
      condition.value = "";
      map.clearMap();
    }
    expose({
      reset: destroyData,
      init: () => {
        destroyData();
        init();
      }
    });
    return (_ctx, _cache) => {
      const _component_a_input = resolveComponent("a-input");
      return openBlock(), createElementBlock("div", _hoisted_1$3, [
        createElementVNode("div", {
          class: "map",
          ref_key: "mapRef",
          ref: mapRef,
          id: unref(mapElementId),
          style: normalizeStyle({ height: __props.mapHeight, width: __props.mapWidth })
        }, null, 12, _hoisted_2$3),
        __props.showSearch ? (openBlock(), createElementBlock("div", _hoisted_3$3, [
          createElementVNode("div", _hoisted_4$3, [
            createVNode(_component_a_input, {
              class: "search-input",
              value: condition.value,
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => condition.value = $event),
              placeholder: "\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",
              onFocus: _cache[1] || (_cache[1] = ($event) => isShowResult.value = true),
              onChange: unref(handleKeywordInput)
            }, null, 8, ["value", "onChange"]),
            createVNode(unref(SearchLine), {
              class: "search-icon",
              fill: "#595959",
              width: "16",
              height: "16",
              viewBox: "0,0,24,24"
            })
          ]),
          searchResult.value.length && isShowResult.value ? (openBlock(), createElementBlock("div", {
            key: 0,
            class: "search-result",
            style: normalizeStyle({ height: unref(searchResultHeight) })
          }, [
            (openBlock(true), createElementBlock(Fragment, null, renderList(searchResult.value, (item) => {
              return openBlock(), createElementBlock("div", {
                class: "result-item",
                key: item.id,
                onClick: ($event) => handleClickResult(item)
              }, [
                createElementVNode("div", _hoisted_6$2, toDisplayString(item.name), 1),
                createElementVNode("div", _hoisted_7$2, toDisplayString(item.district + item.address), 1)
              ], 8, _hoisted_5$2);
            }), 128))
          ], 4)) : createCommentVNode("", true)
        ])) : createCommentVNode("", true),
        renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(addressInfo.value)))
      ]);
    };
  }
});
var index_vue_vue_type_style_index_0_scoped_true_lang$1 = "";
const _withScopeId = (n2) => (pushScopeId("data-v-8ae2e964"), n2 = n2(), popScopeId(), n2);
const _hoisted_1$2 = { class: "location" };
const _hoisted_2$2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { style: { "flex": "none" } }, "\u7ECF\u5EA6\uFF1A", -1));
const _hoisted_3$2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { style: { "flex": "none" } }, "\u7EAC\u5EA6\uFF1A", -1));
const _hoisted_4$2 = /* @__PURE__ */ createTextVNode("\u70B9\u51FB\u9009\u62E9\u4F4D\u7F6E");
const _hoisted_5$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("p", { style: { "text-align": "center", "font-size": "18px", "font-weight": "bold" } }, "\u8BF7\u9009\u62E9\u5730\u56FE\u5B9A\u4F4D", -1));
const _hoisted_6$1 = { style: { "margin-top": "10px" } };
const _hoisted_7$1 = /* @__PURE__ */ createTextVNode("\u7ECF\u7EAC\u5EA6 ");
const _hoisted_8$1 = /* @__PURE__ */ createTextVNode("\u8BE6\u7EC6\u5730\u5740 ");
const _hoisted_9$1 = /* @__PURE__ */ createTextVNode("\u786E\u8BA4");
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    value: C.string.isRequired,
    address: C.string.def(""),
    aMapKey: C.string.def(""),
    aMapSecurity: C.string.def(""),
    aMapInstance: C.any.def(null),
    modalOptions: C.object.def({ width: "80%" }),
    locationStorageKey: C.string.def(""),
    showSearch: C.bool.def(true),
    mapHeight: C.string.def("600px"),
    defaultCenter: C.arrayOf(C.number).def([116.397428, 39.90923]),
    mapOptions: C.object.def({})
  },
  emits: ["update:value", "change", "update:address"],
  setup(__props, { emit: emits }) {
    const props = __props;
    const mapSelectOptions = computed(() => {
      const { value, modalOptions, ...rest } = props;
      return rest;
    });
    const _address = ref("");
    const _location = computed(() => {
      const { longitude, latitude } = currentLocation;
      return longitude && latitude ? `${longitude},${latitude}` : "";
    });
    const isShowModal = ref(false);
    const currentLocation = reactive({
      longitude: null,
      latitude: null
    });
    const mapSelectRef = ref(null);
    function openModal() {
      if (!props.aMapKey && !props.aMapInstance) {
        message.error(`\u8BF7\u4F20\u5165aMapKey`);
        console.error("\u8BF7\u4F20\u5165aMapKey, \u53EF\u524D\u5F80 https://lbs.amap.com \u521B\u5EFA\u5E94\u7528");
        return;
      }
      if (!props.aMapSecurity && !props.aMapInstance) {
        message.error(`\u8BF7\u4F20\u5165aMapSecurity`);
        console.error("\u8BF7\u4F20\u5165aMapSecurity, \u53EF\u524D\u5F80 https://lbs.amap.com \u67E5\u770B\u5E94\u7528\u5B89\u5168\u5BC6\u94A5, \u914D\u5408\u5E94\u7528key\u4E00\u8D77\u4F7F\u7528");
        return;
      }
      isShowModal.value = true;
      mapSelectRef.value && mapSelectRef.value.init();
    }
    function confirm() {
      if (!isSelectLocation()) {
        message.error("\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u70B9\u4F4D");
        return;
      }
      const location2 = currentLocation.longitude + "," + currentLocation.latitude;
      emits("update:value", location2);
      emits("update:address", _address.value);
      emits("change", {
        location: location2,
        address: _address.value
      });
      isShowModal.value = false;
    }
    function closeMapModal() {
    }
    watch(() => props.value, () => {
      if (props.value) {
        const [longitude, latitude] = props.value.split(",").map((str) => parseFloat(str));
        currentLocation.latitude = latitude;
        currentLocation.longitude = longitude;
      } else {
        currentLocation.latitude = null;
        currentLocation.longitude = null;
        _address.value = "";
      }
    }, { immediate: true });
    watch(() => props.address, () => {
      if (props.address) {
        _address.value = props.address;
      }
    }, {
      immediate: true
    });
    function getAddressInfo(e) {
      currentLocation.longitude = e.longitude;
      currentLocation.latitude = e.latitude;
      _address.value = e.address;
    }
    function isSelectLocation() {
      return !!currentLocation.longitude && !!currentLocation.latitude;
    }
    return (_ctx, _cache) => {
      const _component_a_input = resolveComponent("a-input");
      const _component_a_form_item_rest = resolveComponent("a-form-item-rest");
      const _component_a_col = resolveComponent("a-col");
      const _component_a_button = resolveComponent("a-button");
      const _component_a_row = resolveComponent("a-row");
      const _component_a_modal = resolveComponent("a-modal");
      return openBlock(), createElementBlock("div", _hoisted_1$2, [
        createVNode(_component_a_col, {
          span: 6,
          style: { "display": "flex", "align-items": "center" }
        }, {
          default: withCtx(() => [
            _hoisted_2$2,
            createVNode(_component_a_form_item_rest, null, {
              default: withCtx(() => [
                createVNode(_component_a_input, {
                  placeholder: "\u70B9\u51FB\u6309\u94AE\u9009\u62E9\u4F4D\u7F6E",
                  value: __props.value && __props.value.split(",")[0],
                  readOnly: ""
                }, null, 8, ["value"])
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        createVNode(_component_a_col, {
          span: 6,
          offset: 1,
          style: { "display": "flex", "align-items": "center" }
        }, {
          default: withCtx(() => [
            _hoisted_3$2,
            createVNode(_component_a_form_item_rest, null, {
              default: withCtx(() => [
                createVNode(_component_a_input, {
                  placeholder: "\u70B9\u51FB\u6309\u94AE\u9009\u62E9\u4F4D\u7F6E",
                  value: __props.value && __props.value.split(",")[1],
                  readOnly: ""
                }, null, 8, ["value"])
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        createVNode(_component_a_col, {
          span: 6,
          offset: 1
        }, {
          default: withCtx(() => [
            createVNode(_component_a_button, {
              type: "primary",
              onClick: openModal
            }, {
              default: withCtx(() => [
                _hoisted_4$2
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        createVNode(_component_a_modal, mergeProps({
          visible: isShowModal.value,
          "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => isShowModal.value = $event),
          "mask-closable": false
        }, __props.modalOptions, { onCancel: closeMapModal }), {
          footer: withCtx(() => [
            createVNode(_component_a_button, {
              type: "primary",
              size: "large",
              onClick: confirm
            }, {
              default: withCtx(() => [
                _hoisted_9$1
              ]),
              _: 1
            })
          ]),
          default: withCtx(() => [
            _hoisted_5$1,
            createVNode(_sfc_main$4, mergeProps({
              ref_key: "mapSelectRef",
              ref: mapSelectRef,
              value: unref(_location),
              "map-width": "100%"
            }, unref(mapSelectOptions), { onChange: getAddressInfo }), {
              default: withCtx((data) => [
                createElementVNode("div", _hoisted_6$1, [
                  createVNode(_component_a_row, { align: "center" }, {
                    default: withCtx(() => [
                      createVNode(_component_a_col, { span: 8 }, {
                        default: withCtx(() => [
                          createVNode(_component_a_row, {
                            align: "center",
                            style: { "align-items": "center" }
                          }, {
                            default: withCtx(() => [
                              createVNode(_component_a_col, { span: 5 }, {
                                default: withCtx(() => [
                                  _hoisted_7$1
                                ]),
                                _: 1
                              }),
                              createVNode(_component_a_col, { span: 16 }, {
                                default: withCtx(() => [
                                  createVNode(_component_a_form_item_rest, null, {
                                    default: withCtx(() => [
                                      createVNode(_component_a_input, {
                                        value: unref(_location),
                                        placeholder: "\u8BF7\u70B9\u51FB\u83B7\u53D6\u4F4D\u7F6E"
                                      }, null, 8, ["value"])
                                    ]),
                                    _: 1
                                  })
                                ]),
                                _: 1
                              })
                            ]),
                            _: 1
                          })
                        ]),
                        _: 1
                      }),
                      createVNode(_component_a_col, { span: 16 }, {
                        default: withCtx(() => [
                          createVNode(_component_a_row, {
                            align: "center",
                            style: { "align-items": "center" }
                          }, {
                            default: withCtx(() => [
                              createVNode(_component_a_col, { span: 3 }, {
                                default: withCtx(() => [
                                  _hoisted_8$1
                                ]),
                                _: 1
                              }),
                              createVNode(_component_a_col, { span: 16 }, {
                                default: withCtx(() => [
                                  createVNode(_component_a_form_item_rest, null, {
                                    default: withCtx(() => [
                                      createVNode(_component_a_input, {
                                        style: { "width": "100%" },
                                        value: _address.value,
                                        "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _address.value = $event),
                                        placeholder: "\u8BF7\u70B9\u51FB\u83B7\u53D6\u4F4D\u7F6E"
                                      }, null, 8, ["value"])
                                    ]),
                                    _: 1
                                  })
                                ]),
                                _: 1
                              })
                            ]),
                            _: 1
                          })
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  })
                ])
              ]),
              _: 1
            }, 16, ["value"])
          ]),
          _: 1
        }, 16, ["visible"])
      ]);
    };
  }
});
var LocationSelectComponent = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-8ae2e964"]]);
function kebabCase2CamelCase(sName) {
  const reg = /-(.)/g;
  return sName.replace(reg, (fullMatch, g1, index2) => {
    if (index2 === 0)
      return g1;
    return g1.toUpperCase();
  });
}
function translateIconType(iconType) {
  return upperFirst(kebabCase2CamelCase(iconType));
}
const Icon = (props) => {
  const { icon } = props;
  return createVNode($Icon[translateIconType(icon)]);
};
const __default__ = {
  name: "MenuItem"
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    item: C.object.isRequired,
    basePath: C.string.def("")
  },
  setup(__props) {
    const props = __props;
    const handleClickItem = inject("handleClickItem", (path) => {
    });
    const filterChildLength = computed(() => {
      let showChildrenLength = 0;
      const children = props.item.children;
      if (children && children.length) {
        showChildrenLength = children.filter((child) => !child.meta.hidden).length;
      }
      return showChildrenLength;
    });
    const onlyOneChildInfo = computed(() => {
      return props.item.children.filter((child) => !child.meta.hidden)[0];
    });
    function changePage(path) {
      if (isExternal(path)) {
        if (typeof window !== "undefined") {
          window.location.href = path;
        }
      } else {
        handleClickItem(path);
      }
    }
    function isExternal(path) {
      return /^(https?:|mailto:|tel:)/.test(path);
    }
    function resolvePath(routePath) {
      if (isExternal(routePath)) {
        return routePath;
      }
      if (isExternal(props.basePath)) {
        return props.basePath;
      }
      if (routePath.startsWith("/")) {
        return routePath;
      } else {
        return props.basePath + (props.basePath.endsWith("/") ? routePath : `/${routePath}`);
      }
    }
    return (_ctx, _cache) => {
      var _a;
      const _component_menu_item = resolveComponent("menu-item", true);
      const _component_a_sub_menu = resolveComponent("a-sub-menu");
      const _component_a_menu_item = resolveComponent("a-menu-item");
      return !((_a = __props.item.meta) == null ? void 0 : _a.hidden) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
        unref(filterChildLength) > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
          unref(filterChildLength) > 1 ? (openBlock(), createBlock(_component_a_sub_menu, {
            key: __props.item.path
          }, createSlots({
            title: withCtx(() => [
              createTextVNode(toDisplayString(__props.item.meta.title), 1)
            ]),
            default: withCtx(() => [
              (openBlock(true), createElementBlock(Fragment, null, renderList(__props.item.children, (child) => {
                return openBlock(), createBlock(_component_menu_item, {
                  key: child.path,
                  item: child,
                  "base-path": resolvePath(child.path)
                }, null, 8, ["item", "base-path"]);
              }), 128))
            ]),
            _: 2
          }, [
            __props.item.meta && __props.item.meta.icon ? {
              name: "icon",
              fn: withCtx(() => [
                createVNode(unref(Icon), {
                  icon: __props.item.meta.icon
                }, null, 8, ["icon"])
              ])
            } : void 0
          ]), 1024)) : (openBlock(), createBlock(_component_menu_item, {
            key: unref(onlyOneChildInfo).path,
            item: unref(onlyOneChildInfo),
            "base-path": resolvePath(unref(onlyOneChildInfo).path)
          }, null, 8, ["item", "base-path"]))
        ], 64)) : (openBlock(), createBlock(_component_a_menu_item, {
          key: __props.item.path,
          onClick: _cache[0] || (_cache[0] = ($event) => changePage(__props.basePath))
        }, createSlots({
          default: withCtx(() => [
            createTextVNode(" " + toDisplayString(__props.item.meta.title), 1)
          ]),
          _: 2
        }, [
          __props.item.meta && __props.item.meta.icon ? {
            name: "icon",
            fn: withCtx(() => [
              createVNode(unref(Icon), {
                icon: __props.item.meta.icon
              }, null, 8, ["icon"])
            ])
          } : void 0
        ]), 1024))
      ], 64)) : createCommentVNode("", true);
    };
  }
});
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    theme: C.string.def("light"),
    routers: C.arrayOf(C.any).def([]),
    collapsed: C.bool.def(false),
    handleClickItem: P().def((path) => {
    })
  },
  setup(__props) {
    const props = __props;
    provide("handleClickItem", props.handleClickItem);
    return (_ctx, _cache) => {
      const _component_a_menu = resolveComponent("a-menu");
      const _component_a_layout_sider = resolveComponent("a-layout-sider");
      return openBlock(), createBlock(_component_a_layout_sider, {
        class: "layout-left",
        collapsible: "",
        collapsed: __props.collapsed,
        trigger: null,
        theme: __props.theme
      }, {
        default: withCtx(() => [
          renderSlot(_ctx.$slots, "beforeMenu"),
          createVNode(_component_a_menu, mergeProps({
            mode: "inline",
            theme: __props.theme
          }, _ctx.$attrs, { inlineCollapsed: false }), {
            default: withCtx(() => [
              (openBlock(true), createElementBlock(Fragment, null, renderList(__props.routers, (router) => {
                return openBlock(), createBlock(_sfc_main$2, {
                  key: router.path,
                  item: router,
                  "base-path": router.path
                }, null, 8, ["item", "base-path"]);
              }), 128))
            ]),
            _: 1
          }, 16, ["theme"])
        ]),
        _: 3
      }, 8, ["collapsed", "theme"]);
    };
  }
});
const defaultLogoSrc = "https://lishiots.oss-cn-hangzhou.aliyuncs.com/webstatic/public-manage/logo_3x.png";
const defaultAvatar = "https://lishiots.oss-cn-hangzhou.aliyuncs.com/webstatic/public-manage/defaultAvatar.png";
const _hoisted_1$1 = {
  xmlns: "http://www.w3.org/2000/svg",
  width: "24",
  height: "24"
};
const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("path", {
  fill: "none",
  d: "M0 0h24v24H0z"
}, null, -1);
const _hoisted_3$1 = /* @__PURE__ */ createElementVNode("path", { d: "M5 18h14v-6.969C19 7.148 15.866 4 12 4s-7 3.148-7 7.031V18zm7-16c4.97 0 9 4.043 9 9.031V20H3v-8.969C3 6.043 7.03 2 12 2zM9.5 21h5a2.5 2.5 0 1 1-5 0z" }, null, -1);
const _hoisted_4$1 = [
  _hoisted_2$1,
  _hoisted_3$1
];
function render(_ctx, _cache) {
  return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_4$1);
}
var NotificationLine = { render };
var index_vue_vue_type_style_index_0_scoped_true_lang = "";
const _hoisted_1 = { class: "logo-wrap" };
const _hoisted_2 = ["src"];
const _hoisted_3 = {
  key: 0,
  class: "separated"
};
const _hoisted_4 = {
  key: 1,
  class: "subTitle-wrap"
};
const _hoisted_5 = { class: "subTitle" };
const _hoisted_6 = { class: "menu-wrap" };
const _hoisted_7 = { class: "menu" };
const _hoisted_8 = ["onClick"];
const _hoisted_9 = { class: "user-wrap" };
const _hoisted_10 = { class: "extension" };
const _hoisted_11 = { class: "action-wrap" };
const _hoisted_12 = ["src"];
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    logoSrc: { default: defaultLogoSrc },
    count: { default: 0 },
    commandList: { default: () => [] },
    avatar: { default: defaultAvatar },
    userName: { default: "admin" },
    badgeShow: null,
    menus: { default: () => [] },
    active: null,
    backgroundImage: { default: "" },
    backgroundColor: null,
    subTitle: { default: "" }
  },
  emits: ["onBadgeChick", "onActiveChange", "update:active"],
  setup(__props, { emit }) {
    const props = __props;
    const onCommand = (obj) => {
      const commandList = props.commandList || [];
      const command = commandList.find((command2) => command2.key === obj.key);
      command && command.action();
    };
    const onBadgeChick = () => {
      emit("onBadgeChick");
    };
    const currenRouterParams = props.active;
    let currentActive = ref(currenRouterParams || "");
    const onActiveChange = (item) => {
      currentActive.value = item.key;
      emit("update:active", item.key);
      emit("onActiveChange", item);
    };
    return (_ctx, _cache) => {
      const _component_a_badge = resolveComponent("a-badge");
      const _component_a_menu_item = resolveComponent("a-menu-item");
      const _component_a_menu = resolveComponent("a-menu");
      const _component_a_dropdown = resolveComponent("a-dropdown");
      return openBlock(), createElementBlock("div", {
        style: normalizeStyle({
          backgroundColor: __props.backgroundColor,
          backgroundImage: __props.backgroundImage ? "url(" + __props.backgroundImage + ")" : "none",
          backgroundSize: "cover"
        }),
        class: "nav-top"
      }, [
        createElementVNode("div", _hoisted_1, [
          createElementVNode("img", {
            src: __props.logoSrc,
            alt: "logo",
            class: "logo"
          }, null, 8, _hoisted_2),
          __props.subTitle.length ? (openBlock(), createElementBlock("div", _hoisted_3)) : createCommentVNode("", true),
          __props.subTitle.length ? (openBlock(), createElementBlock("div", _hoisted_4, [
            createElementVNode("span", _hoisted_5, toDisplayString(__props.subTitle), 1)
          ])) : createCommentVNode("", true)
        ]),
        createElementVNode("div", _hoisted_6, [
          createElementVNode("div", _hoisted_7, [
            __props.menus && __props.menus.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.menus, (item) => {
              return openBlock(), createElementBlock("div", {
                key: item.key,
                class: normalizeClass([{ active: item.key == unref(currentActive) }, "menu-item"]),
                onClick: ($event) => onActiveChange(item)
              }, [
                createElementVNode("span", null, toDisplayString(item.name), 1)
              ], 10, _hoisted_8);
            }), 128)) : createCommentVNode("", true)
          ]),
          createElementVNode("div", _hoisted_9, [
            createElementVNode("div", _hoisted_10, [
              renderSlot(_ctx.$slots, "default", {}, void 0, true)
            ]),
            __props.badgeShow ? (openBlock(), createBlock(_component_a_badge, {
              key: 0,
              count: __props.count,
              onClick: onBadgeChick
            }, {
              default: withCtx(() => [
                createVNode(unref(NotificationLine), {
                  class: "notice",
                  fill: "white",
                  viewBox: "0 0 24 24"
                })
              ]),
              _: 1
            }, 8, ["count"])) : createCommentVNode("", true),
            createElementVNode("div", _hoisted_11, [
              createElementVNode("img", {
                src: __props.avatar,
                alt: "\u7528\u6237\u5934\u50CF",
                class: "user-avatar"
              }, null, 8, _hoisted_12)
            ]),
            createVNode(_component_a_dropdown, { class: "dropdown-wrap" }, {
              overlay: withCtx(() => [
                createVNode(_component_a_menu, { onClick: onCommand }, {
                  default: withCtx(() => [
                    (openBlock(true), createElementBlock(Fragment, null, renderList(__props.commandList, (item) => {
                      return openBlock(), createBlock(_component_a_menu_item, {
                        key: item.key
                      }, {
                        default: withCtx(() => [
                          createElementVNode("span", null, toDisplayString(item.name), 1)
                        ]),
                        _: 2
                      }, 1024);
                    }), 128))
                  ]),
                  _: 1
                })
              ]),
              default: withCtx(() => [
                createElementVNode("span", {
                  class: "ant-dropdown-link",
                  onClick: _cache[0] || (_cache[0] = withModifiers(() => {
                  }, ["prevent"]))
                }, [
                  createTextVNode(toDisplayString(__props.userName) + " ", 1),
                  createVNode(unref(DownOutlined))
                ])
              ]),
              _: 1
            })
          ])
        ])
      ], 4);
    };
  }
});
var NavTopComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ddedf82a"]]);
const SearchForm = SearchFormComponent;
const LocationSelect = LocationSelectComponent;
const SideBarMenu = _sfc_main$1;
const NavTop = NavTopComponent;
const MapSelect = _sfc_main$4;
var index = {
  install(app) {
    app.component("SearchForm", SearchFormComponent);
    app.component("LocationSelect", LocationSelectComponent);
    app.component("SideBarMenu", _sfc_main$1);
    app.component("NavTop", NavTopComponent);
    app.component("MapSelect", _sfc_main$4);
  }
};
export { LocationSelect, MapSelect, NavTop, SearchForm, SideBarMenu, index as default };
